home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 30
/
Mac Magazin and MacEasy Magazine CD - Issue 30.iso
/
online
/
Mac OS
/
SolscapePPC ƒ.sit
/
SolscapePPC ƒ
/
Scripting Examples
< prev
next >
Wrap
Text File
|
2001-07-09
|
6KB
|
145 lines
tell application "Finder"
--Since I don't know the name of your startup disk, I'll let the Finder tell me
set DiskName to name of startup disk
--We will use the variable DiskName below when saving an image to the desktop.
end tell
tell application "Solscape" --Note; change this to Solscape X for the carbon version.
------------------------------------
------Solscape Functions-----
------------------------------------
--IMPORTANT:
--We MUST wait until Solscape is loaded and ready
--The variable isReady will be "false" until Solscape is loaded. Always loop
--until isReady is true at the begining of a script. If Solscape isn't loaded and ready,
--all AppleEvents will be ignored.
repeat while not (isReady)
end repeat --When Solscape is ready, the loop is quit
if isOffline then --we can check the offline status of Solscape with the isOffline variable.
GoOnline --Set offline status to false, I.E, go online.
end if
--Now lets download Sun Image number 1, EIT 304. Items are indexed, the number is next to the item in the Item list.
GetSunImage 1
-- Now we wait until the download is finished
repeat while isDownloading
end repeat
--Once finished, the script exits the loop. Now we can safely save the picture.
--To do this, we must specify which item to save, and then send a file path and file name to save the image as.
set ErrorNum to SaveSunImage 1 in (DiskName & ":Desktop Folder:EIT_304_Image.jpg")
--We must also receive an integer as a reply to this command. This is an Error Code:
-- 0 - No Error : 1 - Bad Path : 2 - Item exists as directory : 3 - No such image number : 4 - Unknown Error
--So if sucsessful, ErrorNum would be 0
------------------------------------
------Solscape Variables------
------------------------------------
--Here are examples of how to get data out of Solscape:
set ITemp to ionTemperature --Returns a String
set SSCount to sunspotCount --Returns a String
set PDens to protonDensity --Returns a String
set SWnd to solarWind --Returns a String
set RFlux to radioFlux --Returns a String
set NReg to newRegions --Returns a String
set XFlux to xrayFlux --Returns a String
--For Flares, you must specify what type of flare data you want. Xray Flares are strings, Optical are integers
set xFlare to flareXRay type "C" --Returns a String
set oFlare to flareOptical type 1 --Returns a String
set SRise to todaysSunrise --Returns a String
set SSet to todaysSunset --Returns a String
set AEvent to auroraEvent --Returns an Integer, 0-Unknown, 1-low,2-medium,3-high
set MDNew to moonDaysUntilNew --Returns an integer
set MDFull to moonDaysUntilFull --Returns an integer
------------------------------------
------Setting Preferences-----
------------------------------------
--To set the backup folder for saving automatic backups, send an alias or path to Solscape.
--Setting the backup folder for saving copies of all downloads requires you to receive an integer reply. This is an
--error code flag.The error codes are 0 - No Error : 1 - Bad Path : 2 - Item already exists as file : 3 - Unknown Error
set ErrorNum to SetBackupFolder (DiskName & "Desktop Folder:Solscape Downloads")
--"ErrorNum" should be zero. If not, an error occured.
--Also, If the backup folder does not exist, it will be created.
(*
For setting item options, each item is referenced by a number. This is the number next to the item in
the Item list, or in the popup menu for Alerts and Weather.
This next function sets the automatic download period for sun image number 1, EIT 304.
Download periods are integers, from 0 to 12.
The numbers correspond to:
0: Manual
1: 2 Minutes
2: 5 Minutes
3: 10 Minutes
4: 15 Minutes
5: 30 Minutes
6: 45 Minutes
7: 1 hour
8: 1 1/2 hours
9: 2 hours
10: 4 hours
11: 8 hours
12: 12 hours
*)
SetSunDownloadPeriod 1 to 5
--This sets EIT 304 to automatically download every 30 minutes
(*
This next function sets the Data Plot Period for ACE graphs.
Again, the plot period is an integer code, from 0 to 4:
0: 2 Hour
1: 6 Hour
2: 24 Hour
3: 3 Day
4: 7 Day
*)
SetDataPlotPeriod 3 to 1
-- So therefore, this command sets the ACE Protons and Electrons graph plot period to 6 hours.
--In order to set the flags for including items in Update All and Save Backup Copy, we must pass both a number and a STRING,
-- not a boolean. Sorry, but the Applescript handling of sending a boolean as a second parameter is a bit weird and it
--was very counter intuitive. Here is an example of how to set Sun Image 3 (EIT 195) to be included in the Update All feature:
SetUpdateAllSun 3 to "true"
--You can use "True" or "Yes", or "False" or "No".
-- Here is another example that sets the backup option of Earth Image 12 (Eastern US Visible) to false:
SetSaveEarthBackup 12 to "no" --we could also say "false"
------------------------------------
---Controlling the Interface---
------------------------------------
--This next command sets the panel to the desired number. In this case, the Aurora Panel.
GotoPanel 3
--This next command sets the current item selection. In this case, the current Aurora selection is
--set to number 4, the Ultraviolet Imager graph.
SetAuroraItem 4
--This next method opens the Aurora Event Probability floating window
DisplayAuroraAlert
--If you only want to display the Aurora window if there is a high chance for an event, add "with HighOnly" to the end
--of the command, like "DisplayAuroraAlert with HighOnly"
end tell